package com.dw.common.mapper;

import com.dw.common.bean.ResourceBean;
import com.dw.resource.ResourceInfo;

public class ResourceMapper {
    public static ResourceBean resourceInfoToResourceBean(ResourceInfo resourceInfo) {
        ResourceBean resourceBean = new ResourceBean();
        resourceBean.setName(resourceInfo.getName());
        resourceBean.setLength(resourceInfo.getLength());
        resourceBean.setOwner(resourceInfo.getOwner());
        resourceBean.setOffset(resourceInfo.getOffset());
        return resourceBean;
    }

    public static ResourceInfo resourceBeanToResourceInfo(ResourceBean resourceBean) {
        return ResourceInfo.newBuilder()
                .setName(resourceBean.getName())
                .setLength(resourceBean.getLength())
                .setOffset(resourceBean.getOffset())
                .setOwner(resourceBean.getOwner())
                .build();
    }
}
